﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;

namespace HYRevitCode.CurveUtility.ColinearCurveGroup
{
	internal class ColinearGroupMaker
	{
		internal Dictionary<BaseLinePacker, List<Curve>> ResultGroupDic
		{
			get
			{
				return this.m_ResultGroupDic;
			}
			set
			{
				this.m_ResultGroupDic = value;
			}
		}

		internal void GroupingColinearCurve(List<Curve> inputCurves)
		{
			foreach (Curve inputCurve in inputCurves)
			{
				this.GroupingColinearCurve(inputCurve);
			}
		}

		private void GroupingColinearCurve(Curve inputCurve)
		{
			BaseLinePacker key = new BaseLinePacker(inputCurve);
			if (!this.m_ResultGroupDic.ContainsKey(key))
			{
				this.m_ResultGroupDic.Add(key, new List<Curve>
				{
					inputCurve
				});
				return;
			}
			this.ResultGroupDic[key].Add(inputCurve);
		}

		private Dictionary<BaseLinePacker, List<Curve>> m_ResultGroupDic = new Dictionary<BaseLinePacker, List<Curve>>();
	}
}
